/**
 * 主方法......
 * 生成mongodb连接池、国控站点位站点编码
 */

package com.sc.datacollect.main;

import java.io.File;
import java.util.Map;

import com.hw.one.ftp.server.FtpServerUtil;
import com.sc.datacollect.netty.server.Data212TransferServer;
import com.sc.datacollect.netty.server.DataTransferServer;
import com.sc.datacollect.netty.server.FileTransferServer;

import org.apache.log4j.Logger;
import org.quartz.SchedulerException;

import com.sc.datacollect.util.Common;
import com.sc.datacollect.util.CommonConfig;
import com.sc.datacollect.util.MongoDb;

public class MainCollect {
	private static Logger log = Logger.getLogger(MainCollect.class);

	public static Map<String, String> pointRegionCode;
	public static Map<String, String> pointWihName;
	public static Map<String, String> pointWihTypeCode;
	public static MongoDb mongodb;

	public static void main(String[] args) throws SchedulerException {
		mongodb = new MongoDb(CommonConfig.mongohost, CommonConfig.mongoport, CommonConfig.mongodbname,
				CommonConfig.mongouser, CommonConfig.mongopasswd);

		new Thread(){
			public void run(){
				new DataTransferServer();
			}
		}.start();
		log.info("数据同步已启动 ");
		new Thread(){
			public void run(){
				new FileTransferServer();
			}
		}.start();
		log.info("文件同步已启动 ");
		new Thread(){
			public void run(){
				new Data212TransferServer();
			}
		}.start();
		log.info("大气六因子同步已启动");
		
		FtpServerUtil.startFtpServer(CommonConfig.ftpport, new File(Common.dir + "ftpuser.properties"));
		log.info("FTP服务器已启动");
	}
}
